package com.utils;

import com.model.Activityrule;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Created by yangziqiang on 16-9-23.
 */


//这个实例里面选择将对象何种属性拿来做判别
public class ActivityruleComparator implements Comparator<Activityrule> {
    public int compare(Activityrule o1, Activityrule o2) {
        return (o1.getRulecondition() < o2.getRulecondition() ? -1 : (o1.getRulecondition() == o2.getRulecondition() ? 0 : 1));
    }

    public static void main(String[] args) {
        ActivityruleComparator activityruleComparator=new ActivityruleComparator();
        List<Activityrule> activityrules= new ArrayList<Activityrule>();

        //将返回 List<Activityrule>里activityruleComparator声明的条件的最大值
        Activityrule max = Collections.max(activityrules, activityruleComparator);

    }



}